//
// Created by xili on 2024/7/31 19:05.
// Go big or go home.
//
#include <iostream>

using namespace std;

class Solution1 {
public:
    bool isSubsequence(string s, string t) {
        int sn = s.size();
        int tn = t.size();
        int i = 0, j = 0;
        while (i < sn && j < tn) {
            if (s[i] == t[j]) {
                i++;
            }
            j++;
        }
        return i == sn;
    }
};

class Solution2 {
public:
    bool isSubsequence(string s, string t) {
        if (s.empty()) {
            return true;
        }
        int i = 0;
        for (auto &c: t) {
            if (s[i] == c && ++i == s.size()) {
                return true;
            }
        }
        return false;
    }
};